import os

__VIDEO_TYPES = [".mp4", ".avi"]
__IMAGE_TYPES = [".jpg", ".png"]
__AUDIO_TYPES = [".wav", ".acc", ".m4a", ".mp3"]


def is_video(filepath):
    suffix = ___get_suffix(filepath)
    return __matches(suffix, __VIDEO_TYPES)


def is_audio(filepath):
    suffix = ___get_suffix(filepath)
    return __matches(suffix, __AUDIO_TYPES)


def has_suffix(filepath, suffix):
    file_suffix = ___get_suffix(filepath)
    return file_suffix == suffix


def is_image(filepath):
    suffix = ___get_suffix(filepath)
    return __matches(suffix, __IMAGE_TYPES)


def ___get_suffix(filepath):
    if not filepath:
        return None
    return os.path.splitext(filepath)[1]


def __matches(suffix, suffix_list=[]):
    if not suffix or not suffix_list:
        return False
    for sfx in suffix_list:
        if suffix.lower() == sfx.lower():
            return True
    return False
